/* 后台管理通用样式 - 移动端自适应 */
:root {
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    --transition-speed: 0.3s;
}

/* 移动端响应式 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1050;
    }
    
    .sidebar.show {
        transform: translateX(0);
        z-index: 1050; /* 确保在遮罩层之上 */
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100%;
    }
    
    .sidebar-toggle {
        display: block !important;
    }
    
    /* 统计卡片在小屏幕上垂直排列 */
    .stat-card {
        margin-bottom: 15px;
    }
    
    /* 确保侧边栏链接始终可以点击 */
    .sidebar .nav-link {
        pointer-events: auto;
        cursor: pointer;
        position: relative;
        z-index: 1051; /* 确保链接在侧边栏之上 */
    }
}

/* 桌面端响应式 */
@media (min-width: 769px) {
    .sidebar.collapsed {
        width: var(--sidebar-collapsed-width);
    }
    
    .sidebar.collapsed .nav-link span,
    .sidebar.collapsed .sidebar-header h4,
    .sidebar.collapsed .sidebar-header p {
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-speed) ease;
    }
    
    .sidebar.collapsed .nav-link {
        text-align: center;
        padding: 15px 10px;
    }
    
    .sidebar.collapsed .nav-link i {
        margin-right: 0;
        font-size: 1.2rem;
    }
    
    .sidebar.collapsed + .main-content {
        margin-left: var(--sidebar-collapsed-width);
    }
}

/* 通用样式 */
.sidebar {
    background: #2c3e50;
    color: white;
    min-height: 100vh;
    position: fixed;
    width: var(--sidebar-width);
    transition: all var(--transition-speed) ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 1050;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #34495e;
    text-align: center;
}

.sidebar .nav-link {
    color: #bdc3c7;
    padding: 15px 20px;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar .nav-link:hover, 
.sidebar .nav-link.active {
    color: white;
    background: #34495e;
    border-left-color: #3498db;
}

.sidebar .nav-link i {
    width: 20px;
    margin-right: 10px;
    transition: margin var(--transition-speed) ease;
}

.main-content {
    margin-left: var(--sidebar-width);
    padding: 20px;
    transition: margin var(--transition-speed) ease;
    min-height: 100vh;
    background: #f8f9fa;
}

/* 顶部导航栏 */
.top-navbar {
    background: white;
    border-bottom: 1px solid #dee2e6;
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 1030;
    display: none;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
}

/* 统计卡片响应式 */
.stat-card {
    border-radius: 15px;
    border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s;
    margin-bottom: 20px;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.7;
}

/* 表格响应式 */
.table-responsive {
    overflow-x: auto;
}

/* 表单响应式 */
.form-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* 按钮组响应式 */
.btn-group-responsive {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.btn-group-responsive .btn {
    flex: 1;
    min-width: 120px;
}

/* 模态框响应式 */
.modal-dialog-responsive {
    max-width: 95%;
    margin: 1.75rem auto;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 卡片样式 */
.card {
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card-header {
    background: white;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

/* 颜色主题 */
.card-product { border-left: 4px solid #3498db; }
.card-order { border-left: 4px solid #e74c3c; }
.card-cdk { border-left: 4px solid #2ecc71; }
.card-payment { border-left: 4px solid #f39c12; }

/* 工具提示 */
.tooltip-custom {
    position: relative;
}

.tooltip-custom::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.tooltip-custom:hover::after {
    opacity: 1;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
